#include "common.hpp"
#include "log.hpp"

int main()
{
    Log log;
    // 打开信道
    int fd = open(FIFO_FILE, O_WRONLY);
    if(fd == -1) {
        // perror("open");
        log(FATAL, "open file error, error string: %s, error code: %d", strerror(errno), errno);
        exit(FIFO_OPEN_ERR);
    }
    // cout << "client open file done" << endl;
    log(INFO, "client open file done");
    // 开始通信, 向管道中写数据
    std::string line;
    while(true) {
        cout << "Please enter@ ";
        getline(std::cin, line);
        write(fd, line.c_str(), line.size());
    }
    return 0;
}